package com.wisnews.service.sec.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wisnews.mapper.sec.ViewControllerMapper;
import com.wisnews.pojo.sec.entity.ViewController;
import com.wisnews.service.sec.IViewControllerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 视图控制表 服务实现类
 * </p>
 *
 * @author yuyd
 * @since 2020-12-05
 */
@Service
@Slf4j
public class ViewControllerServiceImpl extends ServiceImpl<ViewControllerMapper, ViewController> implements IViewControllerService {

    @Autowired
    private RedisTemplate redisTemplate;

   /* @Override
    public List<ViewController> list() {

        Object viewMapper = redisTemplate.opsForValue().get("viewMapper");
        if (viewMapper != null){
            log.info("<==ViewControllerServiceImpl,读取缓存视图成功！");
            return (List<ViewController>) viewMapper;
        }

        log.info("==>ViewControllerServiceImpl,没有缓存数据访问数据库！");
        List<ViewController> list = super.list();
        redisTemplate.opsForValue().set("viewMapper",list);
        return list;
    }*/
}
